package leetcode.weekly.week330;

import java.util.HashSet;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Set;

//Solution1Test
public class Solution1 {
	public int distinctIntegers(int n) {

		Set<Integer> set = new HashSet<>();
		set.add(n);
		Queue<Integer> queue = new LinkedList<>();
		queue.add(n);
		while (!queue.isEmpty()) {
			int cur = queue.poll();
			for (int i = 1; i <= n; i++) {
				if ((cur % i) == 1) {
					if (set.add(i)) {
						queue.add(i);
					}
				}
			}
		}
		return set.size();
	}

}
